<!DOCTYPE html>
<html>
 <head> 
  <meta charset="UTF-8" /> 
  <title>Table</title> 
  <link rel="stylesheet" href="../assets/plugins/layui/css/layui.css" media="all" /> 
  <link rel="stylesheet" href="../assets/css/global.css" media="all" /> 
 </head> 
 <body> 
  <div class="admin-main"> 
   <form class="layui-form" action="../admin/user/add">  
    <div class="layui-form-item">
		<label class="layui-form-label">用户名</label>
		<div class="layui-input-block">
		   <input type="text" name="name" placeholder="中文、字母、数字、下划线" lay-verify="required" autocomplete="off" class="layui-input">
		</div>
	</div> 
    <div class="layui-form-item">
		<label class="layui-form-label">手机</label>
		<div class="layui-input-block">
		   <input type="text" name="mobile" placeholder="手机号码" lay-verify="mobile" autocomplete="off" class="layui-input">
		</div>
	</div>
    <div class="layui-form-item">
		<label class="layui-form-label">邮箱</label>
		<div class="layui-input-block">
		   <input type="text" name="email" placeholder="邮箱(告警通知等.)" autocomplete="off" class="layui-input">
		</div>
	</div>  
	<div class="layui-form-item" style="padding-left: 100px;color: red;">* 密码默认为手机后八位</div>
   <div class="layui-form-item">
       <label class="layui-form-label">用户类型</label>
       <div class="layui-input-block" style="width: 600px;">
           <input type="radio" name="type" value="user" title="普通用户" checked="checked">
           <input type="radio" name="type" value="groupAdmin" title="业务组管理员">
       </div>
   </div>
   <div class="layui-form-item">
		   <label class="layui-form-label">业务组</label>
		   <div class="layui-input-block" id="group_cont">
			   <ul id="groupList" templateLoad="../admin/group/options" template-id="checklist_tpl" onFinishCallback="onFinishCallback"></ul>
			   <script type="text/html" id="checklist_tpl">
				   {{# layui.each(d, function(index, item){ }}
                   {{#  if(top.currentUser.superAdmin){ }}
				   <span><input type="radio" name="groupId" lay-verify="required" lay-skin="primary" title="{{ item.text }}" value="{{ item.value }}" /></span>
                   {{#  } else{ }}
                   <span><input type="radio" name="groupId" lay-verify="required" lay-skin="primary" title="{{ item.text }}" value="{{ item.value }}" {{top.currentUser.groupId.toString() === item.value ? 'checked' : 'disabled'}} /></span>
                   {{#  } }}
				   {{# }); }}
			   </script>
		   </div>
	   </div>
    <div class="layui-form-item"> 
     <div class="layui-input-block"> 
        <input type="button"  class="layui-btn layui-btn-normal J_ajaxSubmit" onSuccessCallback="reload" value="保存"/>
        <input type="reset" class="layui-btn layui-btn-primary" value="重置"/>
     </div> 
    </div>
   </form> 
  </div> 
  <script type="text/javascript" src="../assets/plugins/layui/layui.js"></script> 
  <script type="text/javascript" src="../assets/js/jeesuitelayui.js?v20180420"></script>  
  <script type="text/javascript">
      function onFinishCallback(data){
    	  if(data != null && data.length > 0){
    		  layui.form.render();
          }else{
              layui.jquery('#group_cont').html('<input type="text" name="groupName" placeholder="第一次直接输入组中文名即可，如：研发一组" class="layui-input">');
          } 
      }
  </script>
 </body>
</html>